@layout("/common/_curd/_container.html"){
<style>
	.ui-jqgrid tr.jqgrow td {
		white-space: normal !important;
		height: 60px;
		line-height: 60px;
		vertical-align: text-top;
		padding-top: 2px;
	}

	.ui-jqgrid-sortable {
		font-size: 14px;
	}

	.ui-jqgrid .ui-jqgrid-htable th div {
		overflow: hidden;
		position: relative;
		height: 50px;
		line-height: 30px;
	}

	.btn-xs, .btn-group-xs > .btn {
		padding-top: 3px;
		padding-bottom: 3px;
		border-width: 1px;
		border-radius: 5px;
	}

	.well-sm {
		padding: 5px 5px 5px 1px;
		border-radius: 3px;
	}

	.welljq {
		min-height: 20px;
		padding: 1px;
		margin-bottom: 1px;
		background-color: #ffffff;
		border: none !important;
		box-shadow: none;
	}

	.ui-jqgrid .ui-jqgrid-htable th {
		height: 22px;
		background: #ffffff;
		padding: 0 2px 0 2px;
	}

</style>
<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";
	
	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});
	
	function initGrid(){
		var grid_url = ctx + "/${code}/list";
		var _colnames = ["", 
						"标题", 
						"单位", 
						"联系人", 
						"联系电话", 
						"地址", 
						"数量", 
						"发布时间", 
						"标签", 
						"审核状态"];
		var _colmodel = [{name:"id", index:"id",hidden:true, width:100},
						{name:"title", index:"title", width:100},
						{name:"company", index:"company", width:100},
						{name:"person", index:"person", width:100},
						{name:"tel", index:"tel", width:100},
						{name:"address", index:"address", width:100},
						{name:"num", index:"num", width:100},
						{name:"addtime", index:"addtime", width:100},
						{name:"tags", index:"tags", width:100},
						{name:"status", index:"status", width:100,formatter:function (value, rows, index) {
							if(value == 1){
								return '<a href="#" onclick="shangjia('+index.id+')" class="btn btn-warning">待审核</a>';
							}else{
								return '<a href="#"  class="btn btn-success">已审核</a>';
							}
						}}];
		
		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel, 
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
</script>
<script>
	shangjia = function (gid) {
		$.get("/xuqiu/shenhe?id="+gid ,null,function (res) {
			$jqGrid.jqGrid("setGridParam", { postData: { sort : "id",  where:"{}",order : "desc" }, page: 1 }).trigger("reloadGrid");
		})
	}
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			@ var _col=[
@		{name:"", index:"id", type:"text"},
			@		{name:"标题", index:"title", type:"text"},
			@		{name:"单位", index:"company", type:"text"},
			@		{name:"联系人", index:"person", type:"text"},
			@		{name:"联系电话", index:"tel", type:"text"},
			@		{name:"地址", index:"address", type:"text"},
			@		{name:"数量", index:"num", type:"text"},
			@		{name:"发布时间", index:"addtime", type:"text"},
			@		{name:"标签", index:"tags", type:"text"},
			@		{name:"审核状态1未审核2已审核", index:"status", type:"text"}							
			@];
			@ include("/common/_function/_search.html",{"col":_col}){}
			<!-- 按钮 -->
			<div class="welljq well-sm" id="btns"></div>
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>
	
	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}
	
@}	